<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style>
      div {
        margin: 10px;
      }
      .top {
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-bottom: 50px solid red;
      }
      .bottom {
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-top: 50px solid red;
      }
      .left {
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-right: 50px solid red;
      }
      .right {
        width: 0;
        height: 0;
        border: 50px solid transparent;
        border-left: 50px solid red;
      }
      .l_box{
        float: left;
      }
      .r_box{
        float: left;
        margin-left: 150px;
      }
      .lt{
        width: 0;
        height: 0;
        border: 70px solid transparent;
        border-top: 70px solid yellow;
        border-left: 70px solid yellow;
      }
      .rt{
        width: 0;
        height: 0;
        border: 70px solid transparent;
        border-top: 70px solid yellow;
        border-right: 70px solid yellow;
      }
      .lb{
        width: 0;
        height: 0;
        border: 70px solid transparent;
        border-bottom: 70px solid yellow;
        border-left: 70px solid yellow;
      }
      .rb{
        width: 0;
        height: 0;
        border: 70px solid transparent;
        border-right: 70px solid yellow;
        border-bottom: 70px solid yellow;
      }
    </style>
  </head>
  <body>
    <p>宽高为0 border透明，对应border显示</p>
    <div class="l_box">
      <!-- 朝上三角 -->
      <div class="top"></div>
      <!-- 朝下三角 -->
      <div class="bottom"></div>
      <!-- 朝左三角 -->
      <div class="left"></div>
      <!-- 朝右三角 -->
      <div class="right"></div>
    </div>
    <div class="r_box">
    <p>宽高为0 对应2格相邻边框显示</p>
      <!-- 左上三角 -->
      <div class="lt"></div>
      <!-- 右上三角 -->
      <div class="rt"></div>
      <!-- 左下三角 -->
      <div class="lb"></div>
      <!-- 右下三角 -->
      <div class="rb"></div>
    </div>
  </body>
</html>
